﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Obsidian.Input
{
    /// <summary>
    /// Interface into the Input system.
    /// </summary>
    public interface Input
    {
        /// <summary>
        /// Last measured linear acceleration of a device in three-dimensional space. (Read Only)
        /// </summary>
        Vector3 Acceleration { get; }

        /// <summary>
        /// Number of acceleration measurements which occurred during last frame.
        /// </summary>
        int AccelerationEventCount { get; }

        /// <summary>
        /// Returns list of acceleration measurements which occurred during the last frame. (Read Only) 
        /// </summary>
        AccelerationEvent[] AcclerationEvents { get; }

        /// <summary>
        /// Is any key or mouse button currently held down? (Read Only)
        /// </summary>
        bool AnyKey { get; }

        /// <summary>
        /// Returns true the first frame the user hits any key or mouse button. (Read Only)
        /// </summary>
        bool AnyKeyDown { get; }

        /// <summary>
        /// The current mouse position in pixel coordinates. (Read Only)
        /// </summary>
        Vector2 MousePosition { get; }

        /// <summary>
        /// Property indicating whether the system handles multiple touches.
        /// </summary>
        bool MultiTouchEnabled { get; }

        /// <summary>
        /// Returns the value of the virtual axis identified by axisName.
        /// </summary>
        /// <param name="axisName"></param>
        /// <returns></returns>
        float GetAxis(string axisName);

        /// <summary>
        /// Returns the value of the virtual axis identified by axisName with no smoothing filtering applied.
        /// </summary>
        /// <param name="axisName"></param>
        /// <returns></returns>
        float GetAxisRaw(string axisName);

        /// <summary>
        /// Returns true while the virtual button identified by buttonName is held down.
        /// </summary>
        /// <param name="buttonName"></param>
        /// <returns></returns>
        bool GetButton(string buttonName);

        /// <summary>
        /// Returns true during the frame the user pressed down the virtual button identified by buttonName.
        /// </summary>
        /// <param name="buttonName"></param>
        /// <returns></returns>
        bool GetButtonDown(string buttonName);

        /// <summary>
        /// Returns true the first frame the user releases the virtual button identified by buttonName.
        /// </summary>
        /// <param name="buttonName"></param>
        /// <returns></returns>
        bool GetButtonUp(string buttonName);

        /// <summary>
        /// Returns an array of strings describing the connected joysticks.
        /// </summary>
        /// <returns></returns>
        string[] GetJoysticksNames();

        /// <summary>
        /// Returns true while the user holds down the key identified by name. Think auto fire.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool GetKey(string name);

        /// <summary>
        /// Returns true during the frame the user starts pressing down the key identified by name.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool GetKeyDown(string name);

        /// <summary>
        /// Returns true during the frame the user releases the key identified by name.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool GetKeyUp(string name);


        /*
         *  button values are 0 for left button, 1 for right button, 2 for the middle button.
         */

        /// <summary>
        /// Returns whether the given mouse button is held down.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool GetMouseButton(int button);

        /// <summary>
        /// Returns true during the frame the user pressed the given mouse button.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool GetMouseButtonDown(int button);

        /// <summary>
        /// Returns true during the frame the user releases the given mouse button.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool GetMouseButtonUp(int button);
    }
}
